//
//  WYButtonItem.swift
//  weibo
//
//  Created by 王玉东 on 16/4/8.
//  Copyright © 2016年 wyd. All rights reserved.
//

import UIKit

class WYButtonItem: UIBarButtonItem {
    
    func setBarButton(title:String , NImage: String , target: AnyObject?, action: Selector) {
    
    let btn = UIButton(type: UIButtonType.Custom)
        
        btn.addTarget(target, action: action, forControlEvents: .TouchUpInside)
        
        btn.setTitle(title, forState: .Normal)
        
        btn.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        
        btn.setTitleColor(UIColor.orangeColor(), forState: .Highlighted)
        
        btn.setBackgroundImage(UIImage(named: NImage), forState: .Normal)
        
        btn.setBackgroundImage(UIImage(named: NImage + "_highlighted"), forState: .Highlighted)
        
        customView = btn
    
    
    
    }
    
    
    
    

}
